<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.fckeditor.net" prefix="FCK" %> 
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML>
<html>
	<head>
		<base href="<%=basePath%>">

		<title>编辑系统功能</title>
		<link rel="stylesheet" type="text/css"
			href="<%=basePath%>jslib/bootstrap/css/bootstrap.css">
		<link rel="stylesheet" type="text/css"
			href="<%=basePath%>css/theme.css">
		<link rel="stylesheet"
			href="<%=basePath%>jslib/font-awesome/css/font-awesome.css">
		<script src="<%=basePath%>jslib/jquery-1.7.2.min.js"
			type="text/javascript"></script>
	</head>

	<body class="content1">
		<div class="header">
			<h1 class="page-title">
				编辑商品信息
			</h1>
		</div>

		<ul class="breadcrumb">
			<li>
				<a href="index.html">商品信息管理</a>
				<span class="divider">/</span>
			</li>
			<li class="active">
				编辑商品信息
			</li>
		</ul>

		<div class="container-fluid">
			<div class="row-fluid">
				<form method="post" action="<%=basePath%>goods/edit" enctype="multipart/form-data">
					<div class="btn-toolbar">
						<input type="submit" class="btn btn-primary" value="保存修改 ">
						<a href="<%=basePath%>goods/goods" class="btn">取消</a>

					</div>
					<!-- 修改操作的method是PUT -->
					<input type="hidden" name="_method" value="PUT">
					
					<div class="tab-pane active in">
						<%-- 错误提示信息 --%>
						<div style="color: red">
							${msg}
						</div>
						<br>
						
						<input type="hidden" name="gid" value="${item.gid }">
						
						<table border="1" width = "100%">
						  <tr>
						    <td>
						    	<label>
						    		<b>商品名称（标题）：</b>
						    	</label>
						    </td>
						    <td>
						    	<input type="text" name="gname" value="${item.gname}" maxlength="50">
						    </td>
						    <td>
						    	<label>
						    		<b>商品单价：</b>
						    	</label>
						    </td>
						    <td>
						    	<input type="text" name="gprice" value="${item.gprice}" maxlength="50">
						    </td>
						  </tr>
						
						  <tr>
						    <td>
						    	<label>
						    		<b>商品图片（上传一张简图就可以了）：</b>
						    	</label>
						    </td>
						  
						    <td>
						    	<img alt="商品图片显示不正常" src="<%= basePath %>${item.gimg}">
						    </td>
						    
						    <td>
							    <label>
							    	<b>修改图片（上传新图片会覆盖旧图片）：</b>
							    </label>
						    </td>
						    
						    <td >
						    	<input type="file" name="gimg" maxlength="50">
						    </td>
						  </tr>
						  
						  <tr>
						    <td>
						    	<label>
						    		<b>商品状态：</b>
						    	</label>
						    </td>
						  
						    <td colspan="3" align="center">
						    	<input type="radio" name="goodsstate" value="0"
							    		<c:if test="${item.goodsstate eq 0 }">
							    			checked="checked"
							    		</c:if>
						    		>已录入但未上架
						    		
						    	<input type="radio" name="goodsstate" value="1"
							    		<c:if test="${item.goodsstate eq 1 }">
							    			checked="checked"
							    		</c:if>
						    		>已上架
						    	
						    	<input type="radio" name="goodsstate" value="-1"
							    		<c:if test="${item.goodsstate eq -1 }">
							    			checked="checked"
							    		</c:if>
						    		>已下架
						    </td>
						  </tr>
						  
						  <tr>
						    <td colspan="4" align="center">
						    	<br>
						    	<label>
						    		<font size="3">
						    			<b>商品描述（如果有商品的详细描述图片可以上传）：</b>
						    		</font>
						    	</label>
						    	<br>
						    </td>
						  </tr>
						  
						  <tr>
						    <td colspan="4" align="center">
						    	<%-- fckeditor插件 --%>
								<FCK:editor instanceName="gdesc" height="800"> 
									<jsp:attribute name="value">
										${item.gdesc}
									</jsp:attribute>
								</FCK:editor>
						    </td>
						  </tr>
						</table>
					</div>
				</form>
			</div>
		</div>
	</body>
</html>
